import React from 'react'
import { Redirect } from 'react-router-dom'

const Discover = React.lazy(() => import('@/pages/discover'))
const Recommend = React.lazy(() => import('@/pages/discover/child-pages/recommend'))
const Ranking = React.lazy(() => import('@/pages/discover/child-pages/ranking'))
const Artist = React.lazy(() => import('@/pages/discover/child-pages/artist'))
const Songs = React.lazy(() => import('@/pages/discover/child-pages/songs'))

const routes = [
  { path: '/', exact: true, render: () => <Redirect to="/discover" /> },
  {
    path: '/discover',
    component: Discover,
    routes: [
      {
        path: '/discover',
        exact: true,
        render: () => <Redirect to="/discover/recommend" />,
      },
      { path: '/discover/recommend', component: Recommend },
      { path: '/discover/ranking', component: Ranking },
      { path: '/discover/artist', component: Artist },
      { path: '/discover/songs', component: Songs },
    ],
  },
]

export default routes
